    /**
     * 
     * @authors Bmeria (67403428@qq.com)
     * @date    2017-07-18 16:34:15
     */



    // borwserRedirect
    (function browserRedirect(){
      var sUserAgent = navigator.userAgent.toLowerCase();
      var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
      var bIsIphone = sUserAgent.match(/iphone os/i) == 'iphone os';
      var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
      var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
      var bIsUc = sUserAgent.match(/ucweb/i) == 'web';
      var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
      var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
      var bIsAndroid = sUserAgent.match(/android/i) == 'android';

      if(bIsIpad || bIsIphone || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM || bIsAndroid ){
        window.location.href = 'http://hh.wh-edu.net/selfm';
      }
    })();






    $(function() {
        // 如果不支持placeholder，用jQuery来完成
        if (!isSupportPlaceholder()) {
            // 遍历所有input对象, 除了密码框
            $('input').not("input[type='password']").each(
                function() {
                    var self = $(this);
                    var val = self.attr("placeholder");
                    input(self, val);
                }
            );

        }
    });

    // 判断浏览器是否支持placeholder属性
    function isSupportPlaceholder() {
        var input = document.createElement('input');
        return 'placeholder' in input;
    }

    // jQuery替换placeholder的处理
    function input(obj, val) {
        var $input = obj;
        var val = val;
        $input.attr({ value: val });
        $input.focus(function() {
            if ($input.val() == val) {
                $(this).attr({ value: "" });
            }
        }).blur(function() {
            if ($input.val() == "") {
                $(this).attr({ value: val });
            }
        });
    }


    $(document).ready(function() {
        $('#fullpage').fullpage({
            anchors: ['firstpage', 'secondpage', '3rdpage', '4thpage', '5thpage', '6thpage', '7thpage', '8thpage', '10thpage', '9thpage'],
            menu: '#menu',
            // navigation: true,
            // navigationPosition: 'right',
            // navigationTooltips: ['First page', 'Second page', 'Third and last page'],
            autoScrolling: false,
            fitToSection: false,
            lockAnchors: true,

            afterLoad: function(anchorLink, index) {
                if (index == 1) {
                    $('.topbar').removeClass('blackbg');
                    $('.right-bar4').hide();
                } else {
                    $('.right-bar4').show();
                }
            },

            onLeave: function(index, nextIndex, direction) {
                var leavingSection = $(this);

                //after leaving section 2
                if (index == 3) {

                    $('#section2').find('.intro').delay(500).animate({
                        left: '-130%'
                    }, 1500, 'easeOutExpo');


                }
            }
        });

    });

    // 右侧栏
    // 
    $(document).on('click', '#go-top', function() {
        $('body,html').animate({ scrollTop: 0 }, 300);
    });




    // 滚动导航跟随
    $(window).scroll(function() {
        var height = $(window).scrollTop();
        var iWinWidth = $(window).width();
        if ((height > 40) & (iWinWidth > 768)) {
            $('.topbar').addClass("blackbg");
        }

        if (height < 100) {
            $(".topbar").removeClass("blackbg");
        }

    });





    // 刷新置顶




    $(document).ready(function() {

        setTimeout(function() {
            scrollTo(0, 0);
        }, 150);


        if (($(window).width() > 768)) {
            $(".jt-box").removeClass('fadeInDown');
            $(".jt-box").addClass('fadeInLeft');
        }
        if (($(window).width() < 768)) {
            $(".jt-box").removeClass('fadeInLeft');
            $(".jt-box").addClass('fadeInDown');
        }
    });

    $(document).on('click', '#page1', function() {
        $.fn.fullpage.moveTo('firstpage', 1);
    });
    $(document).on('click', '#page2', function() {
        $.fn.fullpage.moveTo('secondpage', 1);
    });
    $(document).on('click', '#page3', function() {
        $.fn.fullpage.moveTo('3rdpage', 1);
    });
    $(document).on('click', '#page4', function() {
        $.fn.fullpage.moveTo('4thpage', 1);
    });
    $(document).on('click', '#page5', function() {
        $.fn.fullpage.moveTo('5thpage', 1);
    });
    $(document).on('click', '#page6', function() {
        $.fn.fullpage.moveTo('6thpage', 1);
    });
    $(document).on('click', '#page7', function() {
        $.fn.fullpage.moveTo('7thpage', 1);
    });
    $(document).on('click', '#page8', function() {
        $.fn.fullpage.moveTo('8thpage', 1);
    });
    $(document).on('click', '#page9', function() {
        $.fn.fullpage.moveTo('9thpage', 1);
    });
    $(document).on('click', '#page10', function() {
        $.fn.fullpage.moveTo('10thpage', 1);
    });

    $(document).ready(function() {
        $(".headline-bg").height($(window).height());
    });
    $(window).resize(function() {
        $(".headline-bg").height($(window).height());
    });


    // 手机版菜单
    $(document).on('click', '#slide-bt', function() {
        var nav = "<i class='icon icon-align-justify'>" + "</i>"
        $("header").css({ 'left': '0%' }, 500);
        $(this).html(nav);
        $(this).addClass('active');
    });

    $(document).on('click', '.btn.active', function() {
        var nav2 = "<i class='icon icon-list-ul'>" + "</i>"
        $("header").css({ 'left': '-75%;' }, 500);
        $(this).html(nav2);
        $(this).removeClass('active');
    });


    $(document).on('swipeleft', 'header', function() {
        $("header").css({ 'left': '-75%;' }, 500);
        $(".btn.active").html("<i class='icon icon-list-ul'>" + "</i>");
        $(".btn.active").removeClass('active');
    });



    $(document).on('click', '.attitude-list .attitude-list-box', function() {
        $(this).addClass('active').siblings().removeClass('active');
    });


    $(document).on('click', '.index-form-input', function() {
        $(this).addClass('active').siblings().removeClass('active');
    });








    $(document).ready(function() {

        check_content();

        // 检查宽度
        $(document).on('resize', _.throttle(function() {
            check_content();
        }, 1000));


        function check_content() {


            var heightnav = $(window).outerWidth();

            var myMessager = new $.zui.Messager('您的浏览器窗口分辨率太低，请确保大于1000*768以正常浏览本站', {
                icon: 'bell',
                time: 0 // 不进行自动隐藏
            });

            if (heightnav < 1000) {
                myMessager.show();
            }

            if (heightnav > 1001) {

                $('.messager').removeClass('in', function() {

                    var removeMessager = function() {
                        $('.messagers-holder').remove();
                    };

                    setTimeout(removeMessager, 1000);

                });

            }



        }
    });


// mobile滑动

    $(document).on('swipeleft', 'header', function() {
        $("header").css({'left': '-75%;'},500);
        $(".btn.active").html("<i class='icon icon-list-ul'>" + "</i>");
        $(".btn.active").removeClass('active');
});